<?php
$t1 = microtime(true);
$fileName = 'textfile1.txt';
$sum = 0;
$match = '^start12345end';
$file = fopen($fileName, "r");
while(!feof($file)){
        $line = fgets($file);
        if(ereg($match, $line))
                ++$sum;
}
$t2 = microtime(true);
echo 'sum = ' . $sum . "<br>";

echo $t1 . "<br>";
echo $t2 . "<br>";